<template>
  <div>
    <a @click="showConfirm" class="header-link">
      <a-icon type="logout"/>
      <span>{{ $t('logout') }}</span>
    </a>
  </div>
  
</template>

<script>
import axios from 'axios'
export default {
  methods: {
    showConfirm() {
      let _this = this
      this.$confirm({
        title: this.$t('confirm_message'),
        content: this.$t('please_confirm_logout'),
        okText: this.$t('confirm_yes'),
        okType: 'danger',
        cancelText: this.$t('confirm_no'),
        onOk() {
          _this.handleOk()
        },
      });
    },
    handleOk() {
      axios({
        method: 'post',
        url: '/infra/security/logout',
      }).then(()=>{
        window.location.reload()
      }).catch(()=>{

      })
    },
  },
};
</script>